import React from 'react';
import { Card, Space, Button, Checkbox, Form, Input } from 'antd';
import { connect } from 'umi';
import { Fn } from '@/hoc/index.js';
import './index.less';
import { userLogin } from '@/api/login';
import _ from 'lodash';
export const index = (props: any) => {
  const onFinish = (values: any) => {
    console.log('Success:', values);
    // userLogin(values).then((res) => {
    //   console.log(res);
    // });
    localStorage.setItem('token', 'sss ');
  };

  const onFinishFailed = (errorInfo: any) => {
    console.log('Failed:', errorInfo);
  };
  return (
    <div className="login">
      <div className="box1">
        <Card
          headStyle={{
            textAlign: 'center',
            color: '#fff',
            fontWeight: '666',
          }}
          bordered={false}
          title="管理中心登录"
          style={{ width: 400, background: 'rgba(0, 0, 0, 0.4)' }}
        >
          <Form
            name="basic"
            labelCol={{ span: 24 }}
            wrapperCol={{ span: 30 }}
            style={{ maxWidth: 600 }}
            initialValues={{ remember: true }}
            onFinish={_.debounce(onFinish, 2000)}
            onFinishFailed={onFinishFailed}
            autoComplete="off"
          >
            <Form.Item
              name="username"
              rules={[{ required: true, message: '请输入账号' }]}
            >
              <Input />
            </Form.Item>

            <Form.Item
              name="password"
              rules={[{ required: true, message: '请输入密码!' }]}
            >
              <Input.Password />
            </Form.Item>
            <Form.Item
              name="tel"
              rules={[
                { required: true, message: 'Please input your password!' },
              ]}
            >
              <Space direction="horizontal" style={{ width: '100%' }}>
                <Input />

                <img
                  src="http://fangadmin.shbwyz.com/login/verfiy.html"
                  alt=""
                />
              </Space>
            </Form.Item>
            <Form.Item style={{ marginTop: '20px' }}>
              <Button
                type="primary"
                htmlType="submit"
                style={{ width: '100%' }}
              >
                登录
              </Button>
            </Form.Item>
          </Form>
        </Card>
      </div>
    </div>
  );
};

const mapStateToProps = (state: any) => {
  console.log(state);

  return {};
};

const mapDispatchToProps = {};

export default Fn(connect(mapStateToProps, mapDispatchToProps)(index));
